# 数据处理层,连接数据库，写入数据库，读取数据库
import json
# 读取
def read_data(path):
    with open(path,mode='r',encoding='utf-8') as f:
        data=json.load(f)
    return data
# 写入
def write_data(user_list,path):
    with open(path,mode='w',encoding='utf-8') as f:
        json.dump(user_list,f,ensure_ascii=False)
if __name__ == '__main__':
    path="username.json"
    print(read_data(path))
    # user_list = [{"username": "zhangsan", "password": "123"}, {"username": "lisi", "password": "123"},
    #              {"username": "wangwu", "password": "123"}]
    # write_data(user_list, path)